package dao.auth.mybatis;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import model.auth.Authorities;

import org.springframework.stereotype.Repository;

import core.base.page.Page;
import core.base.page.PageRequest;
import dao.MyBatisBaseDao;
import dao.auth.AuthoritiesDao;

@Repository("auth.AuthoritiesDao")
public class AuthoritiesDaoImpl extends MyBatisBaseDao implements AuthoritiesDao {

	public int deleteById(Long id) {
		return getSqlSessionTemplate().delete("auth.AuthoritiesMapper.deleteById", id);
	}

	public Authorities getById(Long id) {
		return (Authorities)getSqlSessionTemplate().selectOne("auth.AuthoritiesMapper.getById", id);
	}

	public int insert(Authorities model) {
		return  getSqlSessionTemplate().insert("auth.AuthoritiesMapper.insert", model);
	}
	
	public List<Authorities> queryByProperties(Map filter) {
		return getSqlSessionTemplate().selectList("auth.AuthoritiesMapper.queryByProperties", filter);
	}

	public Page<Authorities> queryForPage(PageRequest<Map> pageReq){
		return super.queryForPage(pageReq, "auth.AuthoritiesMapper.queryForPage");
	}
}
